package com.ruoyi.boss.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.boss.domain.TDriverInfo;
import com.ruoyi.boss.service.ITDriverInfoService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 司机列表Controller
 * 
 * @author ruoyi
 * @date 2025-08-18
 */
@RestController
@RequestMapping("/DriveInfo")
public class TDriverInfoController extends BaseController
{
    @Autowired
    private ITDriverInfoService tDriverInfoService;

    /**
     * 查询司机列表列表
     */
    @RequiresPermissions("boss:DriveInfo:list")
    @GetMapping("/list")
    public TableDataInfo list(TDriverInfo tDriverInfo)
    {
        startPage();
        List<TDriverInfo> list = tDriverInfoService.selectTDriverInfoList(tDriverInfo);
        return getDataTable(list);
    }

    /**
     * 导出司机列表列表
     */
    @RequiresPermissions("boss:DriveInfo:export")
    @Log(title = "司机列表", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TDriverInfo tDriverInfo)
    {
        List<TDriverInfo> list = tDriverInfoService.selectTDriverInfoList(tDriverInfo);
        ExcelUtil<TDriverInfo> util = new ExcelUtil<TDriverInfo>(TDriverInfo.class);
        util.exportExcel(response, list, "司机列表数据");
    }

    /**
     * 获取司机列表详细信息
     */
    @RequiresPermissions("boss:DriveInfo:query")
    @GetMapping(value = "/{driverInfoId}")
    public AjaxResult getInfo(@PathVariable("driverInfoId") Long driverInfoId)
    {
        return success(tDriverInfoService.selectTDriverInfoByDriverInfoId(driverInfoId));
    }

    /**
     * 新增司机列表
     */
    @RequiresPermissions("boss:DriveInfo:add")
    @Log(title = "司机列表", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TDriverInfo tDriverInfo)
    {
        return toAjax(tDriverInfoService.insertTDriverInfo(tDriverInfo));
    }

    /**
     * 修改司机列表
     */
    @RequiresPermissions("boss:DriveInfo:edit")
    @Log(title = "司机列表", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TDriverInfo tDriverInfo)
    {
        return toAjax(tDriverInfoService.updateTDriverInfo(tDriverInfo));
    }

    /**
     * 删除司机列表
     */
    @RequiresPermissions("boss:DriveInfo:remove")
    @Log(title = "司机列表", businessType = BusinessType.DELETE)
	@DeleteMapping("/{driverInfoIds}")
    public AjaxResult remove(@PathVariable Long[] driverInfoIds)
    {
        return toAjax(tDriverInfoService.deleteTDriverInfoByDriverInfoIds(driverInfoIds));
    }
}
